import subprocess
import psutil
 
def is_process_running(process_name):
    for proc in psutil.process_iter(['name']):
        if proc.info['name'] == process_name:
            return True
    return False
 
def start_process(process_path):
    subprocess.run(process_path)
 
def main():
    process_name = 'my_process.exe'
    process_path = 'C:\\path\\to\\your\\process.exe'  # 更改为你的进程路径
 
    if not is_process_running(process_name):
        print(f'Process {process_name} is not running. Starting it...')
        start_process(process_path)
    else:
        print(f'Process {process_name} is running.')
 
if __name__ == '__main__':
    main()